﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.ComponentModel;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data;
using System.Globalization;

namespace QLDIAOC
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        GetDataFromSQL m_GetData;

        DataTable m_DiaOcDT;
        DataRowView m_DiaOcDRV = null;
        public static string str = "|,|.|;|/|Á|À|Ả|Ã|Ạ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|" +
                     "Đ|" +
                     "É|È|Ẻ|Ẽ|Ẹ|Ê|Ế|Ề|Ể|Ễ|Ệ|" +
                     "Í|Ì|Ỉ|Ĩ|Ị|" +
                     "Ó|Ò|Ỏ|Õ|Ọ|Ô|Ố|Ồ|Ổ|Ỗ|Ộ|Ơ|Ớ|Ờ|Ở|Ỡ|Ợ|" +
                     "Ú|Ù|Ủ|Ũ|Ụ|Ư|Ứ|Ừ|Ử|Ữ|Ự|" +
                     "Ý|Ỳ|Ỷ|Ỹ|Ỵ|" +
                     "|á|à|ả|ã|ạ|ă|ắ|ằ|ẳ|ẵ|ặ|â|ấ|ầ|ẩ|ẫ|ậ|" +
                     "đ|" +
                     "é|è|ẻ|ẽ|ẹ|ê|ế|ề|ể|ễ|ệ|" +
                     "í|ì|ỉ|ĩ|ị|" +
                     "ó|ò|ỏ|õ|ọ|ô|ố|ồ|ổ|ỗ|ộ|ơ|ớ|ờ|ở|ỡ|ợ|" +
                     "ú|ù|ủ|ũ|ụ|ư|ứ|ừ|ử|ữ|ự|" +
                     "ý|ỳ|ỷ|ỹ|ỵ";
        public Regex nameEx = new Regex(@"^[a-zA-Z +" + str + "]+$");
        public Regex numberEx = new Regex(@"^[0-9 +" + str + "]+$");


        public MainWindow()
        {
            InitializeComponent();
        }
        public MainWindow(SqlConnection _SCN)
        {
            InitializeComponent();
            m_GetData = new GetDataFromSQL(_SCN);
        }
        private void button1_MouseMove(object sender, MouseEventArgs e)
        {
            //button1.Bac;
        }

        private void dtgDiaOc_Loaded(object sender, RoutedEventArgs e)
        {
            LoadTableDiaOC();
        }


        public void LoadTableDiaOC()
        {
            m_DiaOcDT = m_GetData.MakeTable("SHOW_DIA_OC", "DIA_OC");
            dtgDiaOc.ItemsSource = m_DiaOcDT.DefaultView;
        }
 

        //private void button1_Click(object sender, RoutedEventArgs e)
        //{
        //    if(grid2.Visibility==Visibility.Hidden)
        //    {
        //        grid2.Visibility = Visibility.Visible;
        //    }
        //    else
        //        grid2.Visibility = Visibility.Hidden;
        //}
    }
}
